package com.lhk.appframework.engine.login;


import android.content.Context;

import com.lhk.appframework.engine.BaseEngine;
import com.lhk.appframework.factory.FactoryAppDefault;
import com.lhk.appframework.manager.ManagerNetPacketRequest;
import com.lhk.appframework.net.request.login.NetRequestLoginCallback;
import com.lhk.appframework.net.request.login.NetRequestLoginRespnseData;
import com.lhk.appframework.net.request.login.NetRequestLoginResponse;

public class ImplEngineUserLoginDefault extends BaseEngine implements EngineUserLogin {

	@Override
	public void userLogin(Context context, ParamLogin param, CallbackEngineLogin callback) {
		ManagerNetPacketRequest mnpr = FactoryAppDefault.getInstance().getFactoryManager().getManagerNetPacketRequest();
		mnpr.reqLogin(context, param, new NetRequestLoginCallback() {
			@Override
			public void onSuccess(NetRequestLoginResponse response) {
				NetRequestLoginRespnseData data = response.getData();
			}
			
			@Override
			public void onFailure(NetRequestLoginResponse response) {
				String msgCode = response.getMsgCode();
				String statusCode = response.getStatusCode();
			}
		});
	}

	
	
	@Override
	public void userLogin(Context context, String userId, String passwd, CallbackEngineLogin callback) {
		userLogin(context, new ImplParam(userId, passwd), callback);
	}
	
	
	private class ImplParam implements ParamLogin{

		private String userId;
		private String passwd;
		
		public ImplParam(String userId, String passwd) {
			super();
			this.userId = userId;
			this.passwd = passwd;
		}

		@Override
		public String getUserId() {
			// TODO Auto-generated method stub
			return userId;
		}

		@Override
		public String getPasswd() {
			// TODO Auto-generated method stub
			return passwd;
		}
		
	}
}
